﻿@model _2_1_2015_WSite.Models.AppointmentViewModel
@{
    ViewBag.Title = "Create";
}

<link href="~/Content/themes/smoothness/jquery-ui.smoothness.css" rel="stylesheet" />
<link href="~/Content/themes/base/datepicker.css" rel="stylesheet" />
<script src="~/Scripts/jquery-ui-1.11.1.js"></script>

<center>
    <div class="box box-info" style="padding: 15px; width:40%; margin:25px">

        <h2>Request/Update Appointment</h2>
        @using (Html.BeginForm())
        {
            <div class="form-group">
                <label>Current Appt: @Model.Date</label>
            </div>
             <div class="form-group">
                <label for="reqDate">Select Date</label>
                <input type="date" name="reqDate" value="@Model.Date"/>                
             </div>
  
            <div class="form-group">
                <label for="reason" >Reason For Meeting</label>
                <input type="text" name="reason" class="form-control" value="@Model.Reason"/>
              </div>

            <div class="form-group">
                <label for="apptTypeId">Select Appointment Type</label>                
                <select name="apptTypeId" class="form-control" value="@Model.ApptType.ApptTypeId">
                    @foreach (var a in Model.ApptTypes)
                    {
                        <option value=@(a.ApptTypeId)>@(a.ApptTypeDesc)</option>
                    }
                </select>               
                @Html.ValidationMessageFor(a => a.ApptType.ApptTypeId, "", new { @class = "text-danger" })
            </div>
            <div class="form-group">
                <label for="apptTimeFrameId">Select Appointment Time of Day</label>
                <select name="apptTimeFrameId" class="form-control" value="@Model.ApptTimeFrame.ApptTimeFrameId">
                    @foreach (var a in Model.ApptTimeFrames)
                    {
                        <option value=@(a.ApptTimeFrameId)>@(a.ApptTimeFrameDesc)</option>
                    }
                </select>
                @Html.ValidationMessageFor(a => a.ApptTimeFrame.ApptTimeFrameId, "", new { @class = "text-danger" })
            </div>

            if (User.IsInRole("Admin") && Model.AppointmentId > 0)
            {
                <div class="form-group">
                    <label for="accepted">Appointment Accepted</label>
                    <input type="text" name="accepted" class="form-control" value="@Model.Accepted" />
                </div>
            }
            else
            {
                <div class="form-group">
                    <label for="accepted">Appointment Accepted</label>
                    <input type="text" name="accepted" class="form-control" value="@Model.Accepted" readonly />
                </div>
            }        
    

            <input type="hidden" name="reqDate" />
            <input type="hidden" name="reason" />
            <input type="hidden" name="accepted" />
            <input type="hidden"  name="apptTypeId" />
            <input type="hidden"  name="apptTimeFrameId" />
            <input type="hidden" value="@Model.AppointmentId" name="id" />
            <input type="submit" class="btn btn-primary" value="Request/Update Appointment" />
        }
    </div>
</center>






